ostbuild: Drop dead branch-prefix and pull-components
authorColin Walters <walters@verbum.org>
Wed, 16 May 2012 13:23:24 +0000 (09:23 -0400)
committerColin Walters <walters@verbum.org>
Fri, 18 May 2012 20:30:45 +0000 (16:30 -0400)
And other various tweaks.

Makefile-ostbuild.am
src/ostbuild/pyostbuild/builtin_branch_prefix.py [deleted file]
src/ostbuild/pyostbuild/builtin_build.py
src/ostbuild/pyostbuild/builtin_checkout.py
src/ostbuild/pyostbuild/builtin_import_tree.py
src/ostbuild/pyostbuild/builtin_pull_components.py [deleted file]
src/ostbuild/pyostbuild/main.py

index 4b6e04dbc5dd8ef3728fa46aad2c0a21f3a16774..a3b855cbafc515b6e3ac7fbce205b0d7756c6d6e 100644 (file)
@@ -23,7 +23,6 @@ EXTRA_DIST += src/ostbuild/ostbuild.in
 pyostbuilddir=$(libdir)/ostbuild/pyostbuild
 pyostbuild_PYTHON =                                    \
        src/ostbuild/pyostbuild/buildutil.py            \
-       src/ostbuild/pyostbuild/builtin_branch_prefix.py        \
        src/ostbuild/pyostbuild/builtin_build.py        \
        src/ostbuild/pyostbuild/builtin_checkout.py     \
        src/ostbuild/pyostbuild/builtin_chroot_compile_one.py   \
@@ -32,7 +31,6 @@ pyostbuild_PYTHON =                                   \
        src/ostbuild/pyostbuild/builtin_deploy_root.py  \
        src/ostbuild/pyostbuild/builtin_run_qemu.py     \
        src/ostbuild/pyostbuild/builtin_import_tree.py  \
-       src/ostbuild/pyostbuild/builtin_pull_components.py      \
        src/ostbuild/pyostbuild/builtin_privhelper_deploy_qemu.py       \
        src/ostbuild/pyostbuild/builtin_privhelper_run_qemu.py  \
        src/ostbuild/pyostbuild/builtin_git_mirror.py   \
diff --git a/src/ostbuild/pyostbuild/builtin_branch_prefix.py b/src/ostbuild/pyostbuild/builtin_branch_prefix.py
deleted file mode 100755 (executable)
index 81dcd07..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# ostbuild-compile-one-make wraps systems that implement the GNOME build API:
-# http://people.gnome.org/~walters/docs/build-api.txt
-
-import os,sys,stat,subprocess,tempfile,re,shutil
-import argparse
-from StringIO import StringIO
-import json
-
-from . import builtins
-from .ostbuildlog import log, fatal
-from .subprocess_helpers import run_sync, run_sync_get_output
-from . import buildutil
-
-class OstbuildBranchPrefix(builtins.Builtin):
-    name = "prefix-branch"
-    short_description = "Copy current source snapshot to new prefix"
-
-    def __init__(self):
-        builtins.Builtin.__init__(self)
-
-    def execute(self, argv):
-        parser = argparse.ArgumentParser(description=self.short_description)
-        parser.add_argument('--prefix')
-        parser.add_argument('--src-snapshot')
-        parser.add_argument('newprefix')
-
-        args = parser.parse_args(argv)
-        self.parse_config()
-        self.parse_snapshot(args.prefix, args.src_snapshot)
-
-        if args.newprefix == self.prefix:
-            fatal("Specified prefix %r matches active prefix" % (args.newprefix, ))
-
-        db = self.create_db('src-snapshot', prefix=args.newprefix)
-
-        log("Branching from source snapshot %r" % (self.snapshot_path, ))
-
-        orig_prefix = self.prefix
-
-        forked_snapshot = dict(self.snapshot)
-        forked_snapshot['prefix'] = args.newprefix
-
-        for target in forked_snapshot['targets']:
-            name = target['name']
-            if not name.startswith(orig_prefix):
-                fatal("Mismatched name %r in snapshot" % (name, ))
-            target['name'] = name.replace(orig_prefix, args.newprefix)
-        
-        path = db.store(forked_snapshot)
-
-        log("Saved %r" % (path, ))
-
-        run_sync(['ostbuild', 'prefix', args.newprefix],
-                 log_initiation=False, log_success=False)
-
-builtins.register(OstbuildBranchPrefix)
index b4b932b07e2efc6114ba2549381c0f879665c939..bd8975444c39e819300e2369041c3a8df1b049c1 100755 (executable)
@@ -106,7 +106,7 @@ class OstbuildBuild(builtins.Builtin):
                 return previous_build_version
             else:
                 previous_metadata = json.loads(previous_metadata_text)
-                previous_vcs_version = previous_metadata['revision']
+                previous_vcs_version = previous_metadata.get('revision')
                 if current_vcs_version == previous_vcs_version:
                     log("Metadata differs; VCS version unchanged")
                     if self.buildopts.skip_vcs_matches:
@@ -123,9 +123,12 @@ class OstbuildBuild(builtins.Builtin):
         checkoutdir = os.path.join(self.workdir, 'checkouts')
         component_src = os.path.join(checkoutdir, buildname)
         fileutil.ensure_parent_dir(component_src)
-        run_sync(['ostbuild', 'checkout', '--snapshot=' + self.snapshot_path,
-                  '--checkoutdir=' + component_src,
-                  '--clean', '--overwrite', basename])
+        child_args = ['ostbuild', 'checkout', '--snapshot=' + self.snapshot_path,
+                      '--checkoutdir=' + component_src,
+                      '--clean', '--overwrite', basename]
+        if self.args.patches_path:
+            child_args.append('--patches-path=' + self.args.patches_path)
+        run_sync(child_args)
 
         artifact_meta = dict(component)
 
@@ -262,6 +265,7 @@ class OstbuildBuild(builtins.Builtin):
         parser = argparse.ArgumentParser(description=self.short_description)
         parser.add_argument('--prefix')
         parser.add_argument('--src-snapshot')
+        parser.add_argument('--patches-path')
         parser.add_argument('--force-rebuild', action='store_true')
         parser.add_argument('--skip-vcs-matches', action='store_true')
         parser.add_argument('--no-compose', action='store_true')
index 934154886712bcf0e0da2f984143f92ea77abbff..153ea8a949ce3c9586e96bb9d81ecf523284ed06 100755 (executable)
@@ -41,6 +41,7 @@ class OstbuildCheckout(builtins.Builtin):
         parser = argparse.ArgumentParser(description=self.short_description)
         parser.add_argument('--overwrite', action='store_true')
         parser.add_argument('--prefix')
+        parser.add_argument('--patches-path')
         parser.add_argument('--snapshot')
         parser.add_argument('--checkoutdir')
         parser.add_argument('-a', '--active-tree', action='store_true')
@@ -94,7 +95,10 @@ class OstbuildCheckout(builtins.Builtin):
 
         patches = component.get('patches')
         if patches is not None:
-            (patches_keytype, patches_uri) = buildutil.parse_src_key(patches['src'])
+            if self.args.patches_path:
+                (patches_keytype, patches_uri) = ('local', self.args.patches_path)
+            else:
+                (patches_keytype, patches_uri) = buildutil.parse_src_key(patches['src'])
             if patches_keytype == 'git':
                 patches_mirror = buildutil.get_mirrordir(self.mirrordir, patches_keytype, patches_uri)
                 vcs.get_vcs_checkout(self.mirrordir, patches_keytype, patches_uri,
index e83d59af57a77892b3e8d4b4c09d882703c261aa..9fed209ae45e86281c7767fdec5190d2d6e1bb97 100755 (executable)
@@ -35,18 +35,10 @@ class OstbuildImportTree(builtins.Builtin):
     def __init__(self):
         builtins.Builtin.__init__(self)
 
-    def bin_snapshot_to_src(self, bin_snapshot):
-        del bin_snapshot['00ostree-bin-snapshot-version']
-
-        src_snapshot = dict(bin_snapshot)
-        src_snapshot['00ostree-src-snapshot-version'] = 0
-
-        return src_snapshot
-
     def execute(self, argv):
         parser = argparse.ArgumentParser(description=self.short_description)
         parser.add_argument('--tree')
-        parser.add_argument('new_prefix')
+        parser.add_argument('--prefix')
 
         args = parser.parse_args(argv)
         self.parse_config()
@@ -63,17 +55,22 @@ class OstbuildImportTree(builtins.Builtin):
             (ref, revision) = line.split(' ', 1)
             ref_to_revision[ref] = revision
 
+        if args.prefix:
+            target_prefix = args.prefix
+        else:
+            target_prefix = self.snapshot['prefix']
+
         (fd, tmppath) = tempfile.mkstemp(suffix='.txt', prefix='ostbuild-import-tree-')
         f = os.fdopen(fd, 'w')
         for (ref, rev) in ref_to_revision.iteritems():
             if ref.startswith('components/'):
                 ref = ref[len('components/'):]
                 (prefix, subref) = ref.split('/', 1)
-                newref = 'components/%s/%s' % (args.new_prefix, subref)
+                newref = 'components/%s/%s' % (target_prefix, subref)
             elif ref.startswith('bases/'):
                 # hack
                 base_key = '/' + self.snapshot['prefix'] + '-'
-                replace_key = '/' + args.new_prefix + '-'
+                replace_key = '/' + target_prefix + '-'
                 newref = ref.replace(base_key, replace_key)
             else:
                 fatal("Unhandled ref %r; expected components/ or bases/" % (ref, ))
@@ -84,10 +81,10 @@ class OstbuildImportTree(builtins.Builtin):
         run_sync(['ostree', '--repo=' + self.repo,
                   'write-refs'], stdin=open(tmppath))
 
-        self.snapshot['prefix'] = args.new_prefix
+        self.snapshot['prefix'] = target_prefix
 
-        run_sync(['ostbuild', 'prefix', args.new_prefix])
-        self.prefix = args.new_prefix
+        run_sync(['ostbuild', 'prefix', target_prefix])
+        self.prefix = target_prefix
 
         db = self.get_src_snapshot_db()
         path = db.store(self.snapshot)
diff --git a/src/ostbuild/pyostbuild/builtin_pull_components.py b/src/ostbuild/pyostbuild/builtin_pull_components.py
deleted file mode 100755 (executable)
index 8716351..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-import os,sys,subprocess,tempfile,re,shutil
-import copy
-import argparse
-import json
-import time
-import urlparse
-from StringIO import StringIO
-
-from . import builtins
-from .ostbuildlog import log, fatal
-from . import ostbuildrc
-from . import buildutil
-from .subprocess_helpers import run_sync, run_sync_get_output
-from . import kvfile
-from . import odict
-
-class OstbuildPullComponents(builtins.Builtin):
-    name = "pull-components"
-    short_description = "Download the component data for active branch"
-
-    def __init__(self):
-        builtins.Builtin.__init__(self)
-
-    def execute(self, argv):
-        parser = argparse.ArgumentParser(description=self.short_description)
-        parser.add_argument('origin')
-        parser.add_argument('targets', nargs='*')
-        parser.add_argument('--prefix')
-        parser.add_argument('--bin-snapshot')
-
-        args = parser.parse_args(argv)
-        self.parse_config()
-        self.parse_bin_snapshot(args.prefix, args.bin_snapshot)
-
-        child_args = ['ostree-pull', '--repo=' + self.repo, '--prefer-loose',
-                      args.origin]
-        for component,revision in self.bin_snapshot['components'].iteritems():
-            child_args.append(revision)
-        run_sync(child_args)
-        
-builtins.register(OstbuildPullComponents)
index 58a6b01f35784c612de1164e14920124276d2ba1..4f6b27ec1efa17eb825c01039b9faa3213d1d2ed 100755 (executable)
@@ -23,7 +23,6 @@ import argparse
 
 from . import builtins
 from . import builtin_build
-from . import builtin_branch_prefix
 from . import builtin_checkout
 from . import builtin_chroot_compile_one
 from . import builtin_compile_one
@@ -36,7 +35,6 @@ from . import builtin_run_qemu
 from . import builtin_prefix
 from . import builtin_privhelper_deploy_qemu
 from . import builtin_privhelper_run_qemu
-from . import builtin_pull_components
 from . import builtin_resolve
 
 def usage(ecode):